﻿using System;
using System.Reflection;
using Dsl.Ped.Common.Extensions;
using Dsl.Ped.Framework.Resources;

namespace Dsl.Ped.Framework.Helpers 
{
    /// <summary>
    /// Helper methods for enums
    /// </summary>
    public class EnumHelper 
    {
        /// <summary>
        /// Localize the Enumerator against the Lang dictionary
        /// </summary>
        /// <typeparam name="T">Enum <see cref="Type"/> to be localized</typeparam>
        /// <param name="enum">Enum value</param>
        /// <returns>Localized dictionary item if exist, enum.value to string otherwise</returns>
        public static string Localize<T>(T @enum)
        {
            return @enum.Localize(Assembly.GetExecutingAssembly(), typeof(Lang).FullName);
        }
    }
}
